package PingPong;

import javax.swing.JFrame;

public class PingPong extends JFrame {
	public PingPong( String ip ) throws Exception {
		try {
			add(new Client( ip ) );
		} catch( Exception e ) {
			throw e;
		}
		setTitle("PingPong");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setSize(Commons.BOARD_WIDTH+7, Commons.BOARD_HEIGHT+25);
        setLocationRelativeTo(null);
        setIgnoreRepaint(true);
        setResizable(false);
        setVisible(true);
	}
	
	public static void main( String[] args ) {
		if( args.length != 1 ) {
			System.out.println("Usage: java -jar PingPong <ip>");
		} else {
			try {
				new PingPong( args[0] );
			} catch( Exception e ) {
				System.out.println(e.getMessage());
			}
		}
	}
}
